﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace APRIL
{
    class Analytical
    {
        /// <summary>
        /// map id-apr id
        /// </summary>
        public string id { get; set; }
        /// <summary>
        /// tag data
        /// </summary>
        public string tag { get; set; }

        public string map { get; set; }

        public string apr { get; set; }

        public int Prase(string strData)
        {
            try
            {
                string[] strs = strData.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                if (strs.Length >= 2)
                {
                    id = string.Format("{0}", strs[0]);
                    map = id.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[0];
                    apr = id.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[1];
                    tag = strs[1];
                }
                else
                {
                    //数据段个数不能小于2
                    return -1;
                }
            }
            catch
            {
                return -1;
            }
            return 0;
        }
    }
}
